<template>
	<view class="withdrawalRecords">
		<view class="certificate-view">
			<image class="cert-image" v-if="cardImage" :src="cardImage" mode="widthFix"></image>
			<image class="cert-image" v-else src="@/static/index/21.jpg" mode="widthFix"></image>
		</view>
		<!-- <view style="padding: 0 30rpx;">
			<view class="certificate-desc">
				说明：凡激活云计算金条产品两个及以上，可免费领取云计算黄金证书。
				首次激活云计算金条立即返现40%，可立即提现到账，领取证书后，次月立即再返40%，
				以及每日分红提现到账和金条邮寄，即刻享受平台1000万元提现金。
			</view>
		</view> -->
		<view style="height: 150rpx;"></view>
		<!-- 底部按钮 -->
		<view class="homeInfo-message-btnView" @click="getCard()" v-if="cardImage?false:true">
			<view class="homeInfo-message-btn">
				领取证书
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				// 图片
				cardImage:''
			}
		},
		onShow() {
			this.getUserInfo()
		},
		methods:{
			getUserInfo(){
				this.$http.post(this.$api.getUserInfo,{},{token:true}).then(res=>{
					if(res.data.card_url){
						this.cardImage = this.$api.uploadImage+ res.data.card_url
					}
				})
			},
			getCard(){
				this.$http.post(this.$api.getCard,{},{token:true}).then(res=>{
						console.log(res)
					if(res.code == 1){
						uni.showToast({
							title:'领取成功'
						})
						this.getUserInfo()
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.cert-image{
		width: 100%;
	}
	.withdrawalRecords{
		overflow: hidden;
		// background-color: #ffffff;
		min-height: 100vh;
		// padding: 0 30rpx;
	}
	.certificate-desc{
		margin-top: 20rpx;
		padding: 30rpx;
		line-height: 1.8;
		background-color: #ffffff;
		border-radius: 30rpx;
	}
	.certificate-view{
		padding: 30rpx;
	}
	// 底部按钮
	.homeInfo-message-btnView {
		position: fixed;
		bottom: 0;
		width: 100%;
		padding: 20rpx;
		display: flex;
		align-items: center;
		justify-content: center;

		.homeInfo-message-btn {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 90%;
			padding: 20rpx 0;
			background: #FFF0CA;
			border-radius: 20rpx;
			font-size: 15px;
			color: #333333;
		}
	}
</style>